package com.ad.pet.ui;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

/**
 * Created by SEELE on 2019/5/17.
 */

public class ShopOrBuyDialog extends Dialog {
    private int screenWidth;
    public ShopOrBuyDialog(@NonNull Context context) {
        super(context);
    }

    public ShopOrBuyDialog(Context context, int themeResId) {
        super(context, themeResId);
        screenWidth = context.getResources().getDisplayMetrics().widthPixels;

    }

    @Override
    public void show() {
        super.show();
        Window window = this.getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = (screenWidth *  8/ 10); // 设置宽度
        this.getWindow().setAttributes(lp);
        window.setGravity(Gravity.CENTER);
    }
}
